// pages/withdraw/withdraw.js
const app = getApp()
var util = require('../../utils/util.js')
var http = require('../../utils/server.js')

Page({

  data: {

  },

  onLoad: function(options) {
    var that = this
    http.post({
      url: "user/getBalance"
    }, function(data) {
      that.setData({
        balance: data.allow_withdraw
      })
    })
  },
  formSubmit: function(e) {
    var that = this
    http.post({
      url: "user/withdraw",
      money: e.detail.value.money,
      form_id: e.detail.formId
    }, function(data) {
      util.showSuccess('提现成功', function() {
        wx.navigateBack({
          delta: 1
        })
      })
    })

  }
})